<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // callback 回调  msg -> message 消息
        const cb = (msg) => {
            console.log(msg)
        }

        const test = (cb2) => {
            // 一秒之后调用 cb
            // 函数通过参数传入，可以在适当的位置和时机调用
            setTimeout(() => {
                cb2('hello')
            }, 1000)
        }

        test(cb)
    </script>
</body>

</html>